/**
 * 页面顶端
 * 
 */
$(function(){
	var user_id=$('input#user_id').attr('value');
	var the_item=$('input:hidden:eq(0)').attr('value');
	 var title=[{"name":"我的主页","url":"/WDDXSERVER/home.jsp"},
	            {"name":"我的目标","url":"/WDDXSERVER/html/target/daily_target.jsp"},
	            {"name":"目标广场","url":"/WDDXSERVER/html/square/square.jsp"},
	            {"name":"职业测评","url":"/WDDXSERVER/html/occupation_evaluation/homepage.jsp"},
	            {"name":"数据报告","url":"/WDDXSERVER/html/data_analyse/main.jsp"},
	            {"name":"办事大厅","url":"/WDDXSERVER/html/office_hall/office_hall.jsp"}];
	/* var title=[{"name":"我的主页","url":"/WDDXSERVER/home.jsp"},
	 * 			  {"name":"我的目标","url":"/WDDXSERVER/html/target/daily_target.jsp"},
	              {"name":"目标广场","url":"/WDDXSERVER/html/square/square.jsp"},
	              {"name":"职业测评","url":"/WDDXSERVER/html/occupation_evaluation/homepage.jsp"},
	              {"name":"数据报告","url":"/WDDXSERVER/html/data_analyse/class_data_analyse.jsp"}];*/
     var str='<header class="home_header"></header>';
     $('body').prepend(str);
     $('.home_header').append('<div class="header_left"><img src="/WDDXSERVER/img/logo.png" /><h2>智行校园--精准化服务平台</h2></div>')
                      .append('<div class="header_tright"></div>')
                      .append('<ul class="header_bright"></ul>');
     for(var i=0;i<title.length;i++){
    	 $('.header_bright').append('<li><a href="'+title[i].url+'">'+title[i].name+'</a></li>');
     }
     var child_top='<a href="/WDDXSERVER/home.jsp">智行校园首页</a>';
	 child_top+='<a href="/WDDXSERVER/html/personal_center/message.jsp">消息</a>';
	 child_top+='<a href="/WDDXSERVER/html/personal_center/own_info.jsp">'+user_name+'</a>';
	 child_top+='<a href=/WDDXSERVER/login/loginOut?userid='+user_id+'>'+"退出"+'</a>';
	 child_top+='<img src="'+ faceaddress +'">';
	 $(child_top).appendTo('.header_tright');
     $.getJSON('/WDDXSERVER/login/loginWithPc',{userid:user_id},function(data){
    	 $('.header_tright a:eq(2)').text(data.username);
    	 $('.header_tright img').attr('src',data.headphoto);
     });
    
     $('a:contains("'+the_item+'")').parent().addClass('selected').siblings().removeClass('selected');
     $('.header_bright li a').unbind('click').click(function(){
    	  var str='<form method="post"  name="userid_form" ><input type="hidden" value="'+user_id+'" name="userid" /></form>';
    	  $('body').append(str);
    	  $('form[name="userid_form"]').attr('action',$(this).attr('href'));
		  $('form[name="userid_form"]').submit();
		  $('form[name="userid_form"]').remove();
    	  return false ;
     });
     
});